package com.jkc.xh.network;


import com.jkc.xh.constants.Constant;
import com.jkc.xh.models.BindBankCardModel;
import com.jkc.xh.models.HomeImagesModel;
import com.jkc.xh.models.MessageModel;
import com.jkc.xh.models.StockInfoModel;
import com.jkc.xh.models.UserInfo;
import com.jkc.xh.network.models.ActiveservsResponse;
import com.jkc.xh.network.models.AddFavStockRequest;
import com.jkc.xh.network.models.AssetInfoResponse;
import com.jkc.xh.network.models.AutoBuyRequest;
import com.jkc.xh.network.models.AutoListResponse;
import com.jkc.xh.network.models.AutoSellRequest;
import com.jkc.xh.network.models.BalListResponse;
import com.jkc.xh.network.models.BankListResponse;
import com.jkc.xh.network.models.BankSubListResponse;
import com.jkc.xh.network.models.BindCardRequest;
import com.jkc.xh.network.models.BussinessListResponse;
import com.jkc.xh.network.models.BuyIndexRequest;
import com.jkc.xh.network.models.CityListResponse;
import com.jkc.xh.network.models.ConfigResponse;
import com.jkc.xh.network.models.DeleteMyFavRequest;
import com.jkc.xh.network.models.EntrustListResponse;
import com.jkc.xh.network.models.FavListResponse;
import com.jkc.xh.network.models.FundsListResponse;
import com.jkc.xh.network.models.GetSmsCodeRequest;
import com.jkc.xh.network.models.GetSmsListResponse;
import com.jkc.xh.network.models.HaltSellBuyRequest;
import com.jkc.xh.network.models.HaltSellListResponse;
import com.jkc.xh.network.models.HoldAllResponse;
import com.jkc.xh.network.models.HoldAutoRequest;
import com.jkc.xh.network.models.HoldOneResponse;
import com.jkc.xh.network.models.InviteFriendResponse;
import com.jkc.xh.network.models.LoginRequest;
import com.jkc.xh.network.models.LoginResponse;
import com.jkc.xh.network.models.MagicBeanResponse;
import com.jkc.xh.network.models.MaxBuyNumRequest;
import com.jkc.xh.network.models.MaxBuyNumResponse;
import com.jkc.xh.network.models.MayBeanRequest;
import com.jkc.xh.network.models.MayBeanResponse;
import com.jkc.xh.network.models.MessageResponse;
import com.jkc.xh.network.models.ModifyPwdRequest;
import com.jkc.xh.network.models.NoticeResponse;
import com.jkc.xh.network.models.OpenRedbagResponse;
import com.jkc.xh.network.models.PaywayResponse;
import com.jkc.xh.network.models.ProvinceListResponse;
import com.jkc.xh.network.models.RedbagResponse;
import com.jkc.xh.network.models.RefferFriendResponse;
import com.jkc.xh.network.models.RefundCashRequest;
import com.jkc.xh.network.models.RegisterRequest;
import com.jkc.xh.network.models.ResponseEntity;
import com.jkc.xh.network.models.RevokeAutoRequest;
import com.jkc.xh.network.models.RevokeListResponse;
import com.jkc.xh.network.models.RevokeOneRequest;
import com.jkc.xh.network.models.SearchStockResponse;
import com.jkc.xh.network.models.SellMaxCountRequest;
import com.jkc.xh.network.models.ServerListResponse;
import com.jkc.xh.network.models.SoftVersionResponse;
import com.jkc.xh.network.models.SystemHintResponse;
import com.jkc.xh.network.models.TradeSoldAllRequest;
import com.jkc.xh.network.models.TradeSoldPartRequest;

import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.PUT;
import retrofit.http.Path;
import retrofit.http.Query;

/**
 * 服务器接口相关
 * Created by wangjie_91 on 2015/9/15.
 */
public interface ApiService {
    /*1100 普通登录*/
    @POST("login")
    Call<ResponseEntity<LoginResponse>> login(@Body LoginRequest request);

    /*1200 手机注册*/
    @POST("user")
    Call<ResponseEntity<LoginResponse>> register(@Body RegisterRequest request);

    /*1300 发送短信验证码*/
    @POST("code")
    Call<ResponseEntity<Object>> getSmsCode(@Body GetSmsCodeRequest request);

    /*1302 短信通道*/
    @GET("code/sms_list")
    Call<ResponseEntity<GetSmsListResponse>> getSmsSvrList();

    @GET("soft/activeservs")
    Call<ResponseEntity<ServerListResponse>> getServersList();

    @GET("soft/last")
    Call<ResponseEntity<SoftVersionResponse>> getLastSoftVersion(@Query("version") String version);

    @GET("user/{uid}")
    Call<ResponseEntity<UserInfo>> userInfo(@Path("uid") String uid);

    @PUT("user/{uid}")
    Call<ResponseEntity<Object>> updateUserInfo(@Path("uid") String uid, @Body UserInfo info);

    @PUT("user/changepwd/{uid}")
    Call<ResponseEntity<Object>> updateUserPwd(@Path("uid") String uid, @Body ModifyPwdRequest info);

    @GET("info/asset")
    Call<ResponseEntity<AssetInfoResponse>> queryAssetInfo();

    @GET("info/entrust_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<EntrustListResponse>> entrustList(@Query("page_index") int page_index);

    /*2201 可撤查询*/
    @GET("revoke/list?&page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<RevokeListResponse>> queryRevokeList(@Query("page_index") int page_index);

    /***
     * 2305 当日成交/历史成交
     *
     * @param history    类型，0=当日成交，1=历史成交 整数 枚举:0,1 必填
     * @param page_index 分页索引，当前页标，从0开始 整数 默认值:0
     * @return
     */
    @GET("info/buss_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<BussinessListResponse>> queryBusinessList(@Query("history") int history, @Query("page_index") int page_index);

    /*2307 资金流水*/
    @GET("info/funds_list")
    Call<ResponseEntity<FundsListResponse>> queryFundsList(@Query("date_start") long date_start, @Query("date_end") long date_end, @Query("page_index") int page_index, @Query("page_size") int page_size);

    /*2308 平仓结算*/
    @GET("info/bal_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<BalListResponse>> queryBalList(@Query("page_index") int page_index);

    /*2202 单笔撤单*/
    @POST("revoke/one")
    Call<ResponseEntity<Object>> revokeOneRequest(@Body RevokeOneRequest request);

    /*2203 批量撤单*/
    @POST("revoke/batch")
    Call<ResponseEntity<Object>> revokeAllRequest();

    /**
     * 2501 分笔持仓
     *
     * @param page_index
     * @param order      排序，1=购买时间，2=证券代码 整数 枚举:1,2 默认值:1
     * @param issell     “获取可卖 0=所有，1=可卖 整数 默认值:0”
     * @return
     */
    @GET("hold/hold_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<HoldOneResponse>> queryHoldOneListRequest(@Query("page_index") int page_index, @Query("order") int order, @Query("issell") int issell);

    /**
     * 2502 合并持仓
     *
     * @param page_index
     * @param issell     “获取可卖 0=所有，1=可卖 整数 默认值:0”
     * @return
     */
    @GET("hold/holds_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<HoldAllResponse>> queryHoldAllListRequest(@Query("page_index") int page_index, @Query("issell") int issell);

    /**
     * 2002 行情查询
     */
    @GET("buy/stockinfo")
    Call<ResponseEntity<StockInfoModel>> queryStockInfoRequest(@Query("code") String code);

    /*2003 最大可买数量*/
    @POST("buy/max_buy")
    Call<ResponseEntity<MaxBuyNumResponse>> queryMaxBuyNum(@Body MaxBuyNumRequest request);

    /**
     * 2004 大约可低抵用券
     *
     * @param request
     * @return
     */
    @POST("buy/maybean")
    Call<ResponseEntity<MayBeanResponse>> queryMayBean(@Body MayBeanRequest request);

    /*2401 添加自选股*/
    @POST("fav/add")
    Call<ResponseEntity<Object>> addFavStockRequest(@Body AddFavStockRequest request);

    /*2402 删除自选股*/
    @POST("fav/del")
    Call<ResponseEntity<Object>> deleteMyFavStock(@Body DeleteMyFavRequest request);

    /**
     * 2403 我的自选股
     */
    @GET("fav/my_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<FavListResponse>> queryFavListRequest(@Query("page_index") int page_index);

    /*2001 委托买入*/
    @POST("buy/index")
    Call<ResponseEntity<Object>> buyIndex(@Body BuyIndexRequest request);

    /*2101 分笔卖出*/
    @POST("sell/index")
    Call<ResponseEntity<Object>> soldPartRequest(@Body TradeSoldPartRequest request);

    /*2102 分笔卖出时最大可卖数量*/
    @POST("sell/max_sell")
    Call<ResponseEntity<MaxBuyNumResponse>> querySellPartMaxCount(@Body SellMaxCountRequest request);

    /*2103 合并卖出*/
    @POST("sell/group")
    Call<ResponseEntity<Object>> soldAllRequest(@Body TradeSoldAllRequest request);

    /*2102 分笔卖出时最大可卖数量*/
    @POST("sell/max_sell_group")
    Call<ResponseEntity<MaxBuyNumResponse>> querySellAllMaxCount(@Body SellMaxCountRequest request);

    /*2005 股票检索*/
    @GET("buy/search")
    Call<ResponseEntity<SearchStockResponse>> searchStockRequest(@Query("key") String key);

    /*1003界面图片*/
    @GET("soft/welcome")
    Call<ResponseEntity<HomeImagesModel>> homeImages();

    /*3100 充值方式*/
    @GET("userfund/payway")
    Call<ResponseEntity<PaywayResponse>> getPayways();

    /*3102 我要提现*/
    @POST("userfund/cash")
    Call<ResponseEntity<Object>> doRefundCash(@Body RefundCashRequest request);

    /*3003 邀请好友*/
    @GET("usercenter/info_invite")
    Call<ResponseEntity<InviteFriendResponse>> doInviteFriend();

    /*3104 抵用券记录*/
    @GET("userfund/bean_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<MagicBeanResponse>> getMagicBeanList(@Query("page_index") int page_index);

    /*3105 我的红包*/
    @GET("userfund/redbag_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<RedbagResponse>> getRedbagList(@Query("page_index") int page_index);

    /*3106 打开红包*/
    @POST("userfund/redbag")
    Call<ResponseEntity<OpenRedbagResponse>> doOpenRedbag(@Query("id") int id);

    /*3005 站内消息*/
    @GET("usercenter/message_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<MessageResponse>> getUserCenterMessage(@Query("page_index") int page_index);

    /*3006 站内消息详情*/
    @GET("usercenter/message_cont")
    Call<ResponseEntity<MessageModel>> getUserCenterMessageDetail(@Query("id") String id);

    /*3004 推广明细*/
    @GET("usercenter/referrals_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<RefferFriendResponse>> getRefferFriendList(@Query("page_index") int page_index);

    /*3203 开户银行*/
    @GET("userbank/bank_list")
    Call<ResponseEntity<BankListResponse>> getBankList();

    /*3205 开户行省份*/
    @GET("userbank/province_list")
    Call<ResponseEntity<ProvinceListResponse>> getProvinceList();

    /*3206 开户行城市*/
    @GET("userbank/city_list")
    Call<ResponseEntity<CityListResponse>> getCityList(@Query("prov_cd") long prov_cd);

    /*3207 开户行支行*/
    @GET("userbank/sub_list")
    Call<ResponseEntity<BankSubListResponse>> getBankSubList(@Query("bank_id") long bank_id, @Query("city_cd") long city_cd);

    /*3202 我的银行卡*/
    @GET("userbank/info")
    Call<ResponseEntity<BindBankCardModel>> getBindBankInfo();

    /*3201 绑定银行卡*/
    @POST("userbank/bind")
    Call<ResponseEntity<Object>> bindBankCard(@Body BindCardRequest request);

    /*2503 自动补交保证金*/
    @POST("hold/autodeposit")
    Call<ResponseEntity<Object>> autoDeposit(@Body HoldAutoRequest request);

    /*2504 自动延期*/
    @POST("hold/autodelay")
    Call<ResponseEntity<Object>> autoDelay(@Body HoldAutoRequest request);

    /*2505 补交保证金降息*/
    @POST("hold/haltdpt")
    Call<ResponseEntity<Object>> haltDpt(@Body HoldAutoRequest request);

    /*2701 委托自动买入*/
    @POST("auto/buy")
    Call<ResponseEntity<Object>> autoBuyRequest(@Body AutoBuyRequest request);

    /*2702 委托自动卖出*/
    @POST("auto/sell")
    Call<ResponseEntity<Object>> autoSellRequest(@Body AutoSellRequest request);

    /**
     * 2703 策略列表（当日自动委托）
     *
     * @param page_index
     * @return
     */
    @GET("auto/entrust_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<AutoListResponse>> queryAutoListRequest(@Query("page_index") int page_index);

    /*2704 单笔撤单*/
    @POST("auto/revoke")
    Call<ResponseEntity<Object>> revokeAutoRequest(@Body RevokeAutoRequest request);

    /**
     * 2601 待售停牌股
     */
    @GET("haltsell/sell_list?page_size=" + Constant.PAGE_SIZE)
    Call<ResponseEntity<HaltSellListResponse>> queryHaltsellRequest(@Query("page_index") int page_index);

    @POST("haltsell/buy")
    Call<ResponseEntity<Object>> haltsellBuyRequest(@Body HaltSellBuyRequest request);

    @GET("soft/conf")
    Call<ResponseEntity<ConfigResponse>> getConfig();

    @GET("soft/activeservs")
    Call<ResponseEntity<ActiveservsResponse>> getServers();

    @GET("usercenter/info_lev")
    Call<ResponseEntity<SystemHintResponse>> getSysteHintInfo();

    @GET("/article/notice?page_index=0&page_size=10")
    Call<ResponseEntity<NoticeResponse>> queryNoticeList();

    @GET("/article/popup")
    Call<ResponseEntity<NoticeResponse>> queryNoticePopup();
}
